package com.acceptable.qucun.file.mapper;

import com.acceptable.qucun.file.entity.template.FileShareItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.lang.NonNull;

import java.util.List;

@Mapper
public interface FileShareItemMapper extends BaseMapper<FileShareItem> {
    void createTable(@NonNull @Param("userId") Integer userId);

    void dropTable(@NonNull @Param("userId") Integer userId);

    List<FileShareItem> selectByFileId(@NonNull @Param("userId") Integer userId,
                                 @NonNull @Param("fileId") Long fileId);

    List<FileShareItem> selectBatchByFileId(@NonNull @Param("userId") Integer userId,
                                            @NonNull @Param("fileIdList") List<Long> fileIdList);

    List<FileShareItem> selectByShareId(@NonNull @Param("userId") Integer userId,
                                        @NonNull @Param("shareId") Integer shareId);

    FileShareItem selectByShareItemId(@NonNull @Param("userId") Integer userId,
                                      @NonNull @Param("itemId") Long itemId);

    FileShareItem selectByAllData(@NonNull @Param("userId") Integer userId,
                                  @NonNull @Param("shareId") Integer shareId,
                                  @NonNull @Param("fileId") Long fileId);

    int deleteBatchByFileId(@NonNull @Param("userId") Integer userId,
                            @NonNull @Param("fileIdList") List<Long> fileIdList);

    int deleteBatchByShareId(@NonNull @Param("userId") Integer userId,
                            @NonNull @Param("shareIdList") List<Integer> shareIdList);

    int insertBatch(@NonNull @Param("userId") Integer userId,
                    @NonNull @Param("itemList") List<FileShareItem> itemList);
}
